﻿using System;
using System.Diagnostics;
using System.Threading;
using System.Threading.Tasks;
using NetMQ;
using NetMQ.Sockets;


namespace ClientDemo
{
    internal class Program
    {
        public static void Main(string[] args)
        {

            using (var Server = new PublisherSocket())
            {
                  
                
                
                var port= System.Configuration.ConfigurationSettings.AppSettings["port"].ToString();
                var topic= System.Configuration.ConfigurationSettings.AppSettings["topic"].ToString();
                Console.WriteLine($"{port}");
                Server.Bind($"tcp://*:{port}");
                
                while (true)
                {
                   
                   
                    string now =$"{Process.GetCurrentProcess().Id}-"+ DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:fff");
                    
                      
                   var success= Server.SendMoreFrame(topic).TrySendFrame(TimeSpan.FromSeconds(1), now);
                    
                    Console.WriteLine($"{now} {success}");
                    Thread.Sleep(400);
               

                }
                
               
            }

            Console.ReadLine();
        }
    }
}